<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>秀恩爱</title>
<link href="images/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="css/header.css">
<link rel="stylesheet" type="text/css" href="css/story_user.css">
<link href="css/footer.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.11.3.js"></script>

</head>
<script type="text/javascript">
window.onload=function(){
	$.post("regLogServlet?t="+new Date(),{op:"getUserLoginInfo"},function(data){
		var str="";
		var pic="";
		
		if(data==0){ //没有登录
			str="<p><a href='register.html' class='set'>注册</a><a href='login.html' class='up'>登录</a></p>"
			pic="<a class='upload selfProfile' href='#'><img width='80' height='100' src='images/hzh2.png'></a><div class='link'><a class='lYellow' href='#'>编辑资料</a><a class='LGray' href='#'>认证</a></div>";
		}else{
			str="<p><a style='color:red' href='mybaihee.jsp' class='set'>"+data.loginUserInfo[0].NICKNAME+"</a><a href='login.html' class='up'>[切换用户]</a></p>"
			if(data.loginUserInfo[0].TOUXIANG==null){
				pic="<a class='upload selfProfile' href='#'><img width='80' height='100' src='images/hzh2.png'></a><div class='link'><a class='lYellow' href='#'>编辑资料</a><a class='LGray' href='#'>认证</a></div>";
			}else{
				pic="<a class='upload selfProfile' href='#'><img width='80' height='100' src='"+data.loginUserInfo[0].TOUXIANG+"'></a><div class='link'><a class='lYellow' href='#'>编辑资料</a><a class='LGray' href='#'>认证</a></div>";
			}
		}
		$(".setUp").html(str);
		$(".pic").html(pic);
	},"json");
}
</script>
<body>
	<header>
		<script src="js/header.js"></script>
	</header>
	<script>var uls=document.getElementsByClassName("menu_more");
	for(var i=0;i<uls.length;i++){
		uls.item(i).onmouseover=function(){
			this.getElementsByTagName("ul")[0].style.display="block";
		}
		uls.item(i).onmouseout=function(){
			this.getElementsByTagName("ul")[0].style.display="none";
		}
	}</script>

	<div id="baihe_page">
		<div id="baihe_content" class="cols_bj">
			<div id="baihe_col1">
				<div class="subNav">
					<div class="pic">
						<a class="upload selfProfile" href="#"> <img width="80"
							height="100" alt="" src="images/hzh2.png"> </a>
						<div class="link">
							<a class="lYellow" href="#">编辑资料</a> <a class="LGray" href="#/">认证</a>
						</div>
					</div>
					<div class="menuCont skBg1">
						<div class="title">
							<a href="#">我的百合</a>
						</div>
					</div>
					<div class="menuCont skBg2">
						<div class="title">
							<a href="#">会员服务</a>
						</div>
						<ul>
							<li><a href="#"> <span>·</span> 我的订单 </a></li>
							<li><a href="#"> <span>·</span> 水晶会员 </a></li>
							<li><a href="#"> <span>·</span> 至尊会员 </a></li>
							<li><a href="#"> <span>·</span> 金至尊会员 </a></li>
							<li><a href="#" target="_blank"> <span>·</span> 红娘一对一服务
							</a></li>
							<li><a href="#"> <span>·</span> 购买红豆 </a></li>
							<li><a href="#"> <span>·</span> 焦点明星 </a></li>
							<li class="menuHYFF" style="display:none">
							<li class="menuHYFF" style="display:none">
							<li id="zhuiqiu3" class="menuHYFF" style="display:none">
							<li class="menuHYFF" style="display:none">
							<li class="menuHYFF" style="display:none">
						</ul>
						<div class="more">
							<a class="downIcon" href="#">更多</a>
						</div>
					</div>
					<div class="menuCont skBg3">
						<div class="title">
							<a href="#">百合应用</a>
						</div>
						<ul>
							<li><a href="#"> <span>·</span> 恋爱帮帮忙 <img width="22"
									height="10" alt="new" src="images/new.gif"> </a></li>
							<li><a href="#"> <span>·</span> 丘比特之箭 <img width="22"
									height="10" alt="new" src="images/new.gif"> </a></li>
							<li><a href="#"> <span>·</span> 幸运宝藏 <img width="22"
									height="10" alt="new" src="images/new.gif"> </a></li>
							<li><a href="#"> <span>·</span> 百合说说 </a></li>
							<li><a href="#"> <span>·</span> 成长俱乐部 <img width="22"
									height="10" alt="new" src="images/new.gif"> </a></li>
							<li><a href="#"> <span>·</span> 赚取红豆 </a></li>
							<li><a href="#"> <span>·</span> 相亲助手 </a></li>
							<li><a href="#"> <span>·</span> 恋爱ing </a></li>
							<li><a href="#"> <span>·</span> 花瓣抽奖 </a></li>
							<li class="menuBHYY" style="display:none">
							<li class="menuBHYY" style="display:none">
						</ul>
						<div class="more">
							<a class="downIcon" href="#">更多</a>
						</div>
					</div>
					<div class="menuCont">
						<div class="title">
							<a href="#">百合帐户</a>
						</div>
						<ul>
							<li><a href="#"> <span>·</span> 实名认证 </a></li>
							<li><a href="#"> <span>·</span> 择偶意向 </a></li>
							<li><a href="#"> <span>·</span> 帐号设置 </a></li>
							<li><a href="#"> <span>·</span> 修改密码 </a></li>
							<li><a href="#"> <span>·</span> 黑名单 </a></li>
						</ul>
					</div>
					<div class="leftAd">
						<img src="images/storyadv1.jpg" />
					</div>
				</div>
			</div>

			<div id="baihe_col6">
				<div class="list_subnav">
					<ul>
						<li class="now"><a href="#">编辑成功故事空间</a>
						</li>
						<li><a href="uploadstory2.html">上传成功故事</a>
						</li>
						<li><a href="uploadstory3.html">上传甜蜜合影</a>
						</li>
						<li><a href="uploadstory4sss.jsp">管理甜蜜合影</a>
						</li>
					</ul>
				</div>
				<div class="list_content">
					<div class="pic_upload storyCont">
						<form id="aFrm" name="aFrm" method="post">
							<div class="openCont">
								<dl>
									<dt>
										<strong>*</strong> 在百合：
									</dt>
									<dd>
										<input class="text" style="width:50px;" name="lookingup"
											type="text" id="lookingup" value="${uploadstory.timefrombh }" />
										天 找到爱情
										<div class="reg_arrow" id="reg_arrow_lookingup"
											style="display: none">
											<img alt="" src="images/register/pop_now_arrow.gif">
										</div>
										<div class="reg_point_now" id="reg_point_now_lookinup"
											style="display: none">
											<span>请输入数字</span>
										</div>
									</dd>
								</dl>
								<dl>
									<dt>
										<strong>*</strong> 您的注册账号：
									</dt>
									<dd>
										<input class="text" name="phone" type="text" id="phone"
											value="${boyemail }" />
										<div class="reg_arrow" id="reg_arrow_phone"
											style="display: none">
											<img src="images/register/pop_now_arrow.gif" alt="" />
										</div>
										<div class="reg_point_now" id="reg_point_now_phone"
											style="display: none">
											<span>请输入正确的账号</span>
										</div>
									</dd>
								</dl>
								<dl>
									<dt>另一半的注册邮箱：</dt>
									<dd>
										<input class="text" name="email" type="text" id="email"
											value="${girlemail }" />
										<div class="reg_arrow" id="reg_arrow_email"
											style="display: none">
											<img src="images/register/pop_now_arrow.gif" alt="" />
										</div>
										<div class="reg_point_now" id="reg_point_now_email"
											style="display: none">
											<span>请输入正确的邮箱</span>
										</div>
									</dd>
								</dl>
								<dl>
									<dt>
										<strong>*</strong> 你们的爱情标签：
									</dt>
									<dd>（最多可勾选3个爱情标签）</dd>
								</dl>

								<div class="loveTab">
									<label><input class="checkbox" name="loveLabel[]" id="loveLabel" type="checkbox" value="兴趣相投" checked="checked" />兴趣相投</label>
									<label><input class="checkbox" name="loveLabel[]" id="loveLabel" type="checkbox" value="一见钟情" />一见钟情</label> 
									<label><input class="checkbox" name="loveLabel[]" id="loveLabel" type="checkbox" value="夫妻相" />夫妻相</label> 
									<label><input class="checkbox" name="loveLabel[]" id="loveLabel" type="checkbox" value="闪婚" />闪婚</label>
										 <label><input
										class="checkbox" name="loveLabel[]" id="loveLabel"
										type="checkbox" value="再婚" />再婚</label> <label><input
										class="checkbox" name="loveLabel[]" id="loveLabel"
										type="checkbox" value="裸婚" />裸婚</label> <label><input
										class="checkbox" name="loveLabel[]" id="loveLabel"
										type="checkbox" value="异地恋" />异地恋</label> <label><input
										class="checkbox" name="loveLabel[]" id="loveLabel"
										type="checkbox" value="姐弟恋" />姐弟恋</label> <label><input
										class="checkbox" name="loveLabel[]" id="loveLabel"
										type="checkbox" value="黄金剩女" />黄金剩女</label> <label><input
										class="checkbox" name="loveLabel[]" id="loveLabel"
										type="checkbox" value="经济适用男" />经济适用男</label> <label><input
										class="checkbox" name="loveLabel[]" id="loveLabel"
										type="checkbox" value="跨国恋" />跨国恋</label> <label><input
										class="checkbox" name="loveLabel[]" id="loveLabel"
										type="checkbox" value="黄昏恋" />黄昏恋</label> <label><input
										class="checkbox" name="loveLabel[]" id="loveLabel"
										type="checkbox" value="忘年恋" />忘年恋</label> <label><input
										class="checkbox" name="loveLabel[]" id="loveLabel"
										type="checkbox" value="一波三折" />一波三折</label> <label><input
										class="checkbox" name="loveLabel[]" id="loveLabel"
										type="checkbox" value="冲破重阻" />冲破重阻</label>
								</div>


								<dl>
									<dt>自定义标签：</dt>
									<dd>
										<input class="text" style="width:400px;"
											name="input_loveLabel" id="input_loveLabel" type="text"
											value="" title="请输入标签,最多输入两个，用逗号分开，如：心有灵犀，默契" />
									</dd>
								</dl>
								<div class="btnCont">
									<div class="btnYellow34" style="margin-left: 100px;">
										<a href="#" onclick="submit_form();return false;">保存并上传成功故事</a>
									</div>
								</div>
							</div>
							<input type="hidden" name="sub_from" id="sub_from">
						</form>
					</div>

				</div>
			</div>
			<!--headbaihe_col6-->
			<div id="bannner_bg">
				<div class="ad">
					<a tareget="_blank" href="#"> <img src="images/storyadv2.jpg">
					</a>
				</div>
			</div>
			<!--AD-->
		</div>
		<!--headContent-->

		<script src="js/foot.js"></script>
		<!--headFooterEnd-->
	</div>

	<!-- Start Alexa Certify Javascript   <script type="text/javascript">  _atrk_opts = { atrk_acct:"O3rui1asyr00wL", domain:"baihe.com",dynamic: true};  (function() { var as = document.createElement('script'); as.type = 'text/javascript'; as.async = true; as.src = "https://d31qbv1cthcecs.cloudfront.net/atrk.js"; var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(as, s); })();  </script>  <noscript><img src="https://d5nxst8fruw4z.cloudfront.net/atrk.gif?account=O3rui1asyr00wL" style="display:none" height="1" width="1" alt="" /></noscript>  <!-- End Alexa Certify Javascript -->
</body>
</html>

<script language="javascript">
    

    $("#lookingup").blur(function(){  //在百合多少天
        if($("#lookingup").val()=='' || isNaN($("#lookingup").val())){
            $("#reg_arrow_lookingup").show();
            $("#reg_point_now_lookinup").show();
            return false;
        }else{
            $("#reg_arrow_lookingup").hide();
            $("#reg_point_now_lookinup").hide();
        }
    });
    $("#phone").blur(function(){  //自己的账号
        if ($("#phone").val()!='' && !$("#phone").val().match(/^[a-zA-Z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/)) {
            $("#reg_arrow_phone").show();
            $("#reg_point_now_phone").show();
            return false;
        } else{
            $("#reg_arrow_phone").hide();
            $("#reg_point_now_phone").hide();
        }   
    });
    $("#email").blur(function(){ //对方的账号
        if ($("#email").val()!='' && !$("#email").val().match(/^[a-zA-Z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/)) {
            $("#reg_arrow_email").show();
            $("#reg_point_now_email").show();
            return false;
        }else{
            $("#reg_arrow_email").hide();
            $("#reg_point_now_email").hide();
        }  
        
    });
    
   	//爱情标签
    $('input[type=checkbox][id=loveLabel]').click(function(){
    	alert(1);
        var boxArray = document.getElementsByName('loveLabel[]');
        var total = 0;
        for(var i=0;i<boxArray.length;i++){
            if(boxArray[i].checked){
                total++;
            }
        }
      
        if(total>3 ){
            $(this).removeAttr("checked");
            alert("请您选择爱情标签，您最多可以选择3个标签");
            return;
        }
        if(total<1 ){
            alert("请您至少选择1个爱情标签");
            return;
        }
    });    
          
    function submit_form(data){
        
        if($("#lookingup").val()=='' || isNaN($("#lookingup").val())){
            $("#reg_arrow_lookingup").show();
            $("#reg_point_now_lookinup").show();
            return false;
        }
        
        if ($("#phone").val() == '' ||!$("#phone").val().match(/^[a-zA-Z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/)) {
            $("#reg_arrow_phone").show();
            $("#reg_point_now_phone").show();
            return false;
        }    
        if ($("#email").val()!='' && !$("#email").val().match(/^[a-zA-Z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/)) {
            $("#reg_arrow_email").show();
            $("#reg_point_now_email").show();
            return false;
        }
        var boxArray = document.getElementsByName('loveLabel[]');
        var total = 0;
        for(var i=0;i<boxArray.length;i++){
            if(boxArray[i].checked){
                total++;
            }
        }
        if(total<1 ){
            alert("请您选择爱情标签，您最多可以选择3个标签");
            return;
        }
        if(total>3){
            $(this).removeAttr("checked");
            alert("请您选择爱情标签，您最多可以选择3个标签");
            return;
        };
        if($("#input_loveLabel").val()!=0){
            var str=$("#input_loveLabel").val();
            strall=str.split("，");
            if(strall.length>2||strall.length==0){
                alert("请重新输入标签，最多可输入两个标签每个标签只能最多输入四个汉字,并用，隔开（如：心有灵犀，默契）");
                return;
            }else{
                if(strall.length==1){
                    if(str.length>4){
                        alert("请重新输入标签，最多可输入两个标签每个标签只能最多输入四个汉字,并用，隔开（如：心有灵犀，默契）");
                        return;
                    }
                }else{
                    for(var i=0;i<strall.length;i++){
                        if(strall[i].length>4||strall[i].length==0){
                            alert("请重新输入标签，最多可输入两个标签每个标签只能最多输入四个汉字,并用，隔开（如：心有灵犀，默契）");
                            return;
                        }
                    }
                }
            }
        }
        
        var loveTabs = document.getElementsByName('loveLabel[]');
        var input_loveTabs=$("#input_loveLabel").val();
        
        var loveTab="";
        for(var i=0;i<loveTabs.length;i++){
        	if(loveTabs[i].checked){
                loveTab+=loveTabs[i].value+"-";		
            }
        }
        if(input_loveTabs!=null){
        	var stralls=input_loveTabs.split("，");	//自定义爱情标签
        	for(var i=0;i<stralls.length;i++){
        		loveTab+=stralls[i]+"-";
        	}
        }
        
        loveTab=loveTab.substring(0,loveTab.length-1);	//爱情标签
        var timefrombh=$("#lookingup").val(); //在百合多少天找到爱情	
        var boy_email=$("#phone").val(); //男方的登录账号  还得转成用户序列号
        var girl_email=$("#email").val(); //女方的登录账号
        
        //还要先判断邮箱是否存在    审核状态为正在审核
        $.post("storyInfoServlet?t="+new Date(),{op:"addstory",loveTab:loveTab,timefrombh:timefrombh,boy_email:boy_email,girl_email:girl_email},function(data){
        	if(data==2){	//您输入的账号有误，请确认后重新输入
        		alert("您输入的账号有误，请确认后重新输入...");
        	}else if(data==1){
        		alert("恭喜你保存成功");
        		location.href="uploadstory2.html";
        	}else if(data==4){
        		alert("请输入你自己的账号...");
        	}
        });
        
    }

</script>

